import 'dart:convert';

import 'package:flutter_study/config/constant.dart';
import 'package:flutter_study/model/issue_model.dart';
import 'package:flutter_study/util/app_manager.dart';

class HistoryRepository {
  static void saveWatchHistory(Data data) {
    var watchList = AppManager.prefs.getStringList(Constant.watchHistoryList);
    if (watchList == null) {
      watchList = List();
    }
    var jsonParam = data.toJson();
    var jsonStr = json.encode(jsonParam);
    if (!watchList.contains(jsonStr)) {
      watchList.add(jsonStr);
      AppManager.prefs.setStringList(Constant.watchHistoryList, watchList);
    }
  }
}
